using System;
using System.Drawing;
using System.Collections;
using System.Collections.Specialized;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.ComponentModel;
using System.IO;
using System.Web.Security;

namespace webapp4U.UI
{
    [ParseChildren(true)]
    public class ImageObject : System.Web.UI.WebControls.Image
    {
        private int _defaultWidth;
        private int _defaultHeight;
        private string _imageName;
        private string _imagePath;
        private int _imageHeight;
        private int _imageWidth;
        private string _imagefilter;

        public int DefaultWidth
        {
            get { return _defaultWidth; }
            set { _defaultWidth = value; }
        }
        
        public int DefaultHeight
        {
            get { return _defaultHeight; }
            set { _defaultHeight = value; }
        }

        public string ImageName
        {
            get { return _imageName; }
            set { _imageName = value; }
        }

        public string ImagePath
        {
            get { return _imagePath; }
            set { _imagePath = value; }
        }

        public int ImageWidth
        {
            get { return _imageWidth; }
            set { _imageWidth = value; }
        }

        public int ImageHeight
        {
            get { return _imageHeight; }
            set { _imageHeight = value; }
        }


        public string ImageFilter
        {
            get { return _imagefilter; }
            set { _imagefilter = value; }
        }

        protected override void CreateChildControls()
        {
            EnableViewState = false;

            if (ImageFilter == "" || ImageFilter == null)
            {
                this.Attributes.Add("onload", "this.style.filter='alpha(opacity=100,finishopacity=100,style=1)';");
                this.Attributes.Add("onmouseover", "this.style.filter='alpha(opacity=60,finishopacity=50,style=1)';");
                this.Attributes.Add("onmouseout", "this.style.filter='alpha(opacity=100,finishopacity=100,style=1)';");
            }

            if (ImageName !="")
            {
                this.ImageUrl = ImagePath + ImageName;
               // this.ToolTip = ImageName;
            }
            else
            {
                this.Visible = false;
            }
            
        }
     
    }
}
